<template>
	<view class="mainPage whitePage" :style="{'padding-top': `${$store.state.safeArea.top || 0}px`, 'padding-bottom': `${$store.state.safeArea.bottom || 0}px`}">
		<public-head :title="title" onlyHead noshadow></public-head>
		<view class="box">
			<text>*</text>完成实名认证后，可开通在线问诊服务
		</view>
		<view class="box2">
			<view class="title">身份证照片</view>
			<view class="zheng">
				<u-upload :action="action" :maxCount="2" @on-success="change()" @on-remove="del()"  ></u-upload>
			</view>
			<view class="title2">请拍摄证书清晰照片，需包含姓名，个人照片及钢印、证书编号(上传身份证正反面)</view>
		</view>
		<view class="box4">
			<u-popup v-model="show" mode="center" border-radius="14" width="584rpx" height="442rpx" :mask-close-able="false">
			<view class="img" >
				<u-avatar :src="src" :show-level="true" level-icon="checkmark-circle" level-bg-color="#8a8a8a" ></u-avatar>
				</view>
				<view class="title1">您的认证信息已提交</view>
				<view class="title2">审核中，预计2个工作日内完成</view>
				<view class="but" @click="tz">
					<button>好的</button>
				</view>
			</u-popup>
		</view>
		<view class="box3">
			<view class="but1" @click="back"><button>上一步</button></view>
			<view class="but2" @click="toexamine"><button>提交审核</button></view>
		</view>
	</view>
</template>

<script>
	var that
	import publicHead from "@/components/publicHead/publicHead.vue"
	export default {
		components: {
			publicHead
		},
		data() {
			return {
				title: '医生注册',
				show: false,
				src: 'https://swl-1304532176.cos.ap-guangzhou.myqcloud.com/chongesheng_doctor/icon/archives.png',
				action: '',
				list:[],//身份证
				item:{}
			}
		},
		onLoad(options) {
			that = this
			that.item = JSON.parse(options.item)
			that.action = that.$util.getUrl1() + 'Doctor_uploadFile';
		},
		methods:{
			// 兽医资格证上传成功返回
			change(e){
				console.log(e.data.url);
				that.list.push(e.data.url)
			},
			// 兽医资格证删除返回
			del(e){
				// console.log(e);
				that.list.splice(e,1)
			},
			toexamine(){
				if(that.list.length != 2){
					uni.showToast({
						title: '请上传正反面身份证照片',
						icon: 'none',
						duration: 1500
					});
					return
				}
				that.item.idcard_img = that.list[0] + ',' + that.list[1]
				console.log("that.item: " + JSON.stringify(that.item));
				uni.showLoading({
					mask: true,
					title: '加载中...'
				});
				that.$postAjax1('Doctor_setDoctorInfo',that.item,function(data){
					uni.hideLoading()
					that.show = true
				})
			},
			tz(){
				uni.reLaunch({
					url:'./examine'
				})
			},
			back(){
				uni.navigateBack({
					delta:1
				})
			},
		}
	}
</script>

<style  scoped lang="scss">
button::after{ border: none; }
.box{
	padding: 60rpx 30rpx;
	text{
		color: red;
	}
}
.box2{
	.title{
		padding:10rpx 30rpx;
	}
	.zheng{
		padding:10rpx 30rpx;
	}
	.title2{
		padding:30rpx 30rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: 400;
		line-height: 34rpx;
		color: #979797;
		opacity: 1;
	}
}
.box4{
	.img{
		width: 100%;padding: 20rpx 42%;
	}
	.title1{
		text-align: center;
		font-size: 32rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		color: #333333;
		padding: 0rpx 30rpx;
	}
	.title2{
		text-align: center;
		font-size: 24rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #999999;
		line-height: 34rpx;
		padding: 0rpx 30rpx;
		margin-top: 30rpx;
	}
	.but{
		margin-top: 50rpx;
		width: 100%;
		button{
			background: linear-gradient(219deg, #FF9331 0%, #FE7600 100%);
			border-radius: 4rpx;
			width: 30%;
			height: 60rpx;
			line-height: 60rpx;
			color: #FFFFFF;
			font-size: 28rpx;
		}
	}
}
.box3{
	width: 100%;
	position: absolute;
	bottom: 200rpx;
	.but1{
		height: 50rpx;
		line-height: 50rpx;
		display: inline-block;
		width: 50%;
		button{
			width: 80%;
			border: 1px #F78361 solid;
			background: #FFFFFF;
			color: #F78361;
			border-radius: 4rpx;
		}
	}
	.but2{
		height: 50rpx;
		line-height: 50rpx;
		display: inline-block;
		width: 50%;
		button{
			width: 80%;
			background: linear-gradient(227deg, #FF9331 0%, #FE7600 100%);
			opacity: 1;
			border-radius: 4rpx;
			color: #FFFFFF;
		}
	}
}
</style>
